package com.buildings.util;

import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;

import com.bigkoo.pickerview.OptionsPickerView;
import com.buildings.bean.AddressBean;

import java.util.ArrayList;
import java.util.List;

public class PickViewUtil {

        public static void showPickerViewOne(Context context, String title, List<String> options1Items, final OptionsPickerView.OnOptionsSelectListener listener) {// 弹出选择器（省市区三级联动）
            if(TextUtils.isEmpty(title)){
                title = "请选择";
            }
            OptionsPickerView pvOptions = new OptionsPickerView.Builder(context, new OptionsPickerView.OnOptionsSelectListener() {
                @Override
                public void onOptionsSelect(int options1, int options2, int options3, View v) {
                    //返回的分别是三个级别的选中位置
    //                etAddress.setText(options1Items.get(options1).getPickerViewText() + "  "
    //                        + options2Items.get(options1).get(options2) );
                    listener.onOptionsSelect(options1,options2,options3,v);
                }
            })
                    .setTitleText(title)
                    .setDividerColor(Color.BLACK)
                    .setTextColorCenter(Color.BLACK) //设置选中项文字颜色
                    .setContentTextSize(20)
                    .build();
            pvOptions.setPicker(options1Items);//一级选择器
    //        pvOptions.setPicker(options1Items, options2Items);//二级选择器
    //        pvOptions.setPicker(options1Items, options2Items, options3Items);//三级选择器
            pvOptions.show();
    }


}
